package com.mm.config;

import com.mm.interceptor.CustomWebInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class InterceptorConfiguration extends WebMvcConfigurerAdapter {
    @Bean
    public CustomWebInterceptor customWebInterceptor(){
        return new CustomWebInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(customWebInterceptor()).addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
